{"ast":null,"code":"var _jsxFileName = \"/data/messenger.client/src/App.tsx\",\n  _s = $RefreshSig$();\nimport React from 'react';\nimport Title from \"./utils/Title\";\nimport { Context } from \"./index\";\nimport { observer } from \"mobx-react-lite\";\nimport { Route, Routes, useNavigate } from \"react-router-dom\";\nimport { Auth, Im, Profile, Contacts } from \"./pages\";\nimport { browserRouteAuth, browserRouteContacts, browserRouteIm, browserRouteProfile } from \"./routes\";\nimport { Button, Modal } from \"./components\";\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\nimport { Fragment as _Fragment } from \"react/jsx-dev-runtime\";\nconst App = () => {\n  _s();\n  const {\n    store\n  } = React.useContext(Context);\n  const navigate = useNavigate();\n  const [showModal, setShowModal] = React.useState(false);\n  Title();\n  React.useEffect(() => {\n    if (localStorage.getItem(`${process.env.REACT_APP_NAME_TOKEN}`)) {\n      store.checkAuth();\n    }\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, []);\n  React.useEffect(() => {\n    store.getAuth() ? navigate(browserRouteIm) : navigate(browserRouteAuth);\n    if (store.getAuth()) {\n      if (!store.getProfile().verified) {\n        setShowModal(true);\n      } else {\n        setShowModal(false);\n        store.getContactsFromAPI();\n      }\n    }\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, [store.getAuth(), store.getProfile()]);\n  if (store.getLoading()) {\n    return /*#__PURE__*/_jsxDEV(\"section\", {\n      className: \"global_loading\",\n      children: /*#__PURE__*/_jsxDEV(\"div\", {\n        className: \"loading\"\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 41,\n        columnNumber: 17\n      }, this)\n    }, void 0, false, {\n      fileName: _jsxFileName,\n      lineNumber: 40,\n      columnNumber: 13\n    }, this);\n  }\n  return /*#__PURE__*/_jsxDEV(_Fragment, {\n    children: [/*#__PURE__*/_jsxDEV(Modal, {\n      active: showModal,\n      title: \"Пользователь не верифицирован!\",\n      hasFunctionButtons: false,\n      children: [/*#__PURE__*/_jsxDEV(\"div\", {\n        children: \"\\u0412\\u0430\\u043C \\u043D\\u0435\\u043E\\u0431\\u0445\\u043E\\u0434\\u0438\\u043C\\u043E \\u043F\\u0440\\u043E\\u0439\\u0442\\u0438 \\u0432\\u0435\\u0440\\u0438\\u0444\\u0438\\u043A\\u0430\\u0446\\u0438\\u044E \\u043F\\u043E \\u043F\\u043E\\u0447\\u0442\\u0435, \\u0447\\u0442\\u043E\\u0431\\u044B \\u0438\\u0441\\u043F\\u043E\\u043B\\u044C\\u0437\\u043E\\u0432\\u0430\\u0442\\u044C \\u0444\\u0443\\u043D\\u043A\\u0446\\u0438\\u043E\\u043D\\u0430\\u043B \\u043F\\u0440\\u0438\\u043B\\u043E\\u0436\\u0435\\u043D\\u0438\\u044F.\"\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 53,\n        columnNumber: 17\n      }, this), /*#__PURE__*/_jsxDEV(Button, {\n        text: \"Обновить\",\n        fullWidth: false,\n        customClassName: \"\",\n        callback: () => {\n          store.getProfileFromAPI();\n          console.log(store.getProfile().verified);\n        }\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 54,\n        columnNumber: 17\n      }, this)]\n    }, void 0, true, {\n      fileName: _jsxFileName,\n      lineNumber: 48,\n      columnNumber: 13\n    }, this), /*#__PURE__*/_jsxDEV(Routes, {\n      children: [/*#__PURE__*/_jsxDEV(Route, {\n        path: browserRouteAuth,\n        element: /*#__PURE__*/_jsxDEV(Auth, {}, void 0, false, {\n          fileName: _jsxFileName,\n          lineNumber: 64,\n          columnNumber: 57\n        }, this)\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 64,\n        columnNumber: 17\n      }, this), /*#__PURE__*/_jsxDEV(Route, {\n        path: browserRouteIm,\n        element: /*#__PURE__*/_jsxDEV(Im, {}, void 0, false, {\n          fileName: _jsxFileName,\n          lineNumber: 65,\n          columnNumber: 55\n        }, this)\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 65,\n        columnNumber: 17\n      }, this), /*#__PURE__*/_jsxDEV(Route, {\n        path: browserRouteProfile,\n        element: /*#__PURE__*/_jsxDEV(Profile, {}, void 0, false, {\n          fileName: _jsxFileName,\n          lineNumber: 66,\n          columnNumber: 60\n        }, this)\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 66,\n        columnNumber: 17\n      }, this), /*#__PURE__*/_jsxDEV(Route, {\n        path: browserRouteContacts,\n        element: /*#__PURE__*/_jsxDEV(Contacts, {}, void 0, false, {\n          fileName: _jsxFileName,\n          lineNumber: 67,\n          columnNumber: 61\n        }, this)\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 67,\n        columnNumber: 17\n      }, this)]\n    }, void 0, true, {\n      fileName: _jsxFileName,\n      lineNumber: 63,\n      columnNumber: 13\n    }, this)]\n  }, void 0, true);\n};\n_s(App, \"hXF5bycMHE5UtpKXGAaoUG48kvs=\", false, function () {\n  return [useNavigate];\n});\n_c = App;\nexport default _c2 = observer(App);\nvar _c, _c2;\n$RefreshReg$(_c, \"App\");\n$RefreshReg$(_c2, \"%default%\");","map":{"version":3,"names":["React","Title","Context","observer","Route","Routes","useNavigate","Auth","Im","Profile","Contacts","browserRouteAuth","browserRouteContacts","browserRouteIm","browserRouteProfile","Button","Modal","App","store","useContext","navigate","showModal","setShowModal","useState","useEffect","localStorage","getItem","process","env","REACT_APP_NAME_TOKEN","checkAuth","getAuth","getProfile","verified","getContactsFromAPI","getLoading","getProfileFromAPI","console","log"],"sources":["/data/messenger.client/src/App.tsx"],"sourcesContent":["import React, {FC} from 'react';\nimport Title from \"./utils/Title\";\nimport {Context} from \"./index\";\nimport {observer} from \"mobx-react-lite\";\nimport {Route, Routes, useNavigate} from \"react-router-dom\";\nimport {Auth, Im, Profile, Contacts} from \"./pages\";\nimport {browserRouteAuth, browserRouteContacts, browserRouteIm, browserRouteProfile} from \"./routes\";\nimport {Button, Modal} from \"./components\";\n\nconst App: FC = () => {\n    const {store} = React.useContext(Context);\n    const navigate = useNavigate();\n    const [showModal, setShowModal] = React.useState<boolean>(false);\n\n    Title();\n\n    React.useEffect( () => {\n        if (localStorage.getItem(`${process.env.REACT_APP_NAME_TOKEN}`)) {\n            store.checkAuth();\n        }\n        // eslint-disable-next-line react-hooks/exhaustive-deps\n    }, []);\n\n    React.useEffect( () => {\n        (store.getAuth())? navigate(browserRouteIm): navigate(browserRouteAuth);\n\n        if (store.getAuth()) {\n            if (!store.getProfile().verified) {\n                setShowModal(true);\n            } else {\n                setShowModal(false);\n                store.getContactsFromAPI();\n            }\n        }\n        // eslint-disable-next-line react-hooks/exhaustive-deps\n    }, [store.getAuth(), store.getProfile()]);\n\n    if (store.getLoading()) {\n        return (\n            <section className='global_loading'>\n                <div className=\"loading\"></div>\n            </section>\n        )\n    }\n\n    return (\n        <>\n            <Modal\n                active={showModal}\n                title={\"Пользователь не верифицирован!\"}\n                hasFunctionButtons={false}\n            >\n                <div>Вам необходимо пройти верификацию по почте, чтобы использовать функционал приложения.</div>\n                <Button\n                    text={\"Обновить\"}\n                    fullWidth={false}\n                    customClassName=''\n                    callback={\n                        () => {store.getProfileFromAPI(); console.log(store.getProfile().verified)}\n                    }\n                />\n            </Modal>\n            <Routes>\n                <Route path={browserRouteAuth} element={<Auth/>} />\n                <Route path={browserRouteIm} element={<Im/>} />\n                <Route path={browserRouteProfile} element={<Profile/>} />\n                <Route path={browserRouteContacts} element={<Contacts/>} />\n            </Routes>\n        </>\n    );\n}\n\nexport default observer(App);\n"],"mappings":";;AAAA,OAAOA,KAAK,MAAY,OAAO;AAC/B,OAAOC,KAAK,MAAM,eAAe;AACjC,SAAQC,OAAO,QAAO,SAAS;AAC/B,SAAQC,QAAQ,QAAO,iBAAiB;AACxC,SAAQC,KAAK,EAAEC,MAAM,EAAEC,WAAW,QAAO,kBAAkB;AAC3D,SAAQC,IAAI,EAAEC,EAAE,EAAEC,OAAO,EAAEC,QAAQ,QAAO,SAAS;AACnD,SAAQC,gBAAgB,EAAEC,oB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